	<form id="userForm"  action="<?=site_url(array("c" => "cms_user", "m" => "edit_user", "user_id" => $user['id']))?>" method="post">
		<input type="hidden" name="item_id" value="<?=$user['id']?>" />
		<table border="0" cellspacing="0" cellpadding="0" class="form-table">
			<tr>
				<th>Username: </th>
				<td><input type="text" name="item_loginname" class="input-text required" value="<?=$user['loginname']?>"></td>
			</tr>
			<tr>
				<th>Password: </th>
				<td><input type="password" name="item_passwd" class="input-text"
					value=""></td>
			</tr>
			<tr>
				<th>Confirm Password: </th>
				<td><input type="password" name="item_passwd_conf" class="input-text"
					value=""></td>
			</tr>
			<tr>
				<th>Avatar: </th>
				<td>
					<input type="text" id="item_avatar" name="item_avatar" value="<?=$user['avatar']?>">
					<input id="item_avatar_btn" name="item_avatar_btn" type="button" class="ins" value="..." />
					<?php if(!empty($user['avatar'])):?>
					<img src="<?=$user['avatar']?>" width="30"/>
					<?php endif;?>
				</td>
			</tr>
			<tr>
				<th>Firstname: </th>
				<td><input type="text" name="item_first_name" class="input-text" value="<?=$user['first_name']?>"></td>
			</tr>
			<tr>
				<th>Lastname: </th>
				<td><input type="text" name="item_last_name" class="input-text" value="<?=$user['last_name']?>"></td>
			</tr>
			<tr>
				<th>Email: </th>
				<td><input type="text" name="item_email" class="input-text required email" value="<?=$user['email']?>"></td>
			</tr>
			<tr>
				<th>Company Name: </th>
				<td><input type="text" name="item_company_name" class="input-text required" value="<?=$user['company_name']?>"></td>
			</tr>
			<tr>
				<th>Zipcode: </th>
				<td><input type="text" name="item_zipcode" class="input-text required number" value="<?=$user['zipcode']?>"></td>
			</tr>
			<tr>
				<th>City: </th>
				<td><input type="text" name="item_city" class="input-text" value="<?=$user['city']?>"></td>
			</tr>
			<tr>
				<th>Address: </th>
				<td><input type="text" name="item_address" class="input-text" value="<?=$user['address']?>"></td>
			</tr>
			<tr>
				<th>Is Special: </th>
				<td>
					Yes <input type="radio" name="item_is_special" class="" <?='yes'==$user['is_special'] ? 'checked="true"':''?> value="yes"/>
					No <input type="radio" name="item_is_special" class=""  <?='no'==$user['is_special'] ? 'checked="true"':''?> value="no"/>
				</td>
			</tr>
			<tr>
				<th>Role: </th>
				<td>
					<select name="item_role_id" class="input-text required">
						<option value="">Please select</option>
						<?php foreach($roles as $item):?>
						<option value="<?=$item['id']?>" <?=$item['id']==$user['role_id'] ? "selected='true'":""?>>
							<?=$item['name']?>
						</option>
						<?php endforeach;?>
					</select>
				</td>
			</tr>
			<tr>
				<th>Types: </th>
				<td>
					<select name="item_types[]" class="input-text" multiple="true" size="4">
						<option value="">Please select</option>
						<?php foreach($types as $type):?>
						<?php 
							$selected = '';
							if(is_array($type_selected)){
								$selected = array_search($type['id'], $type_selected) !== FALSE ? "selected='true'":"";
							}
						?>
						<option value="<?=$type['id']?>" <?=$selected?>>
							<?=$type['title']?>
						</option>
						<?php endforeach;?>
					</select>
				</td>
			</tr>
			<tr>
				<th>Description: </th>
				<td>
					<textarea name="item_desc" class="input-textarea-medium" cols="28" rows="5"><?=$user['desc']?></textarea>
				</td>
			</tr>
			<tr>
				<th>Google map: </th>
				<td>
					<textarea name="item_google_map" class="input-textarea-medium" cols="28" rows="5"><?=$user['google_map']?></textarea>
				</td>
			</tr>
			<!--tr>
				<th>&nbsp;</th>
				<td>
					<input type="button" class="ins" onClick="javascript:history.back();" value="Cancel" />
					<input name="Submit" type="submit" class="ins" value="Save" />
				</td>
			</tr-->
		</table>
	</form>
<script type="text/javascript">
	var finder = new CKFinder();
	finder.BasePath = '/system/plugins/ckfinder/';
	finder.SelectFunction = SetFileFieldNewImg;
	$("#item_avatar_btn").bind("click", function(){
		finder.Popup();
	});
	function SetFileFieldNewImg(fileUrl) {
		$('#item_avatar').val(fileUrl);
	}
</script>